package com.sky.mapper;

import com.sky.entity.ShoppingCart;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author zhangyu
 * @data 2023/4/24 9:50
 */
@Mapper
public interface ShoppingCartMapper {

    List<ShoppingCart> getShoopingCartByUserId(ShoppingCart shoppingCart);
    /**
     * 根据购物车主键id修改购物车商品的数量
     */
    @Update("update shopping_cart set number=#{number} where id=#{id}")
    void updateShoppingCartCount(@Param("number")Integer number,@Param("id")Long id);
    void insertShoppingCart(ShoppingCart shoppingCart);
    @Delete("delete from shopping_cart where id=#{id}")
    void deleteOneById(@Param("id")Long id);
    @Delete("delete from shopping_cart where user_id=#{id}")
    void deleteShoppingByUserId(@Param("id")Long id);
}
